package controllers;

import java.io.Serializable;

import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.RequestScoped;

import controller.CandidateHistoryController;
import dao.CandidateDAORemote;

@ManagedBean
@RequestScoped
public class LinkController implements Serializable{

	private static final long serialVersionUID = 1L;
	private String link;
	
	@EJB CandidateDAORemote candidateDAO;
	 
    @ManagedProperty(value="#{candidateHistoryController}")
    private CandidateHistoryController chc;

	public void setLink(String link) {
		System.out.println("1");
		this.link = link;
	}

	public String getLink() {
		return link;
	}

	public void setChc(CandidateHistoryController chc) {
		System.out.println("2");
		this.chc = chc;
	}

	public CandidateHistoryController getChc() {
		return chc;
	}

	public void candidateHistoryLink() {
		if (link != "" && link != null){
			System.out.println("3"); 
 		chc.setCandidateDTO(candidateDAO.getCandidateByLink(link));
		}
	}

}
